/**
* @Title: <P>UserServiceImpl.java</P>
* @Package <P>com.micro.boot.biz.service</P>
* @Description: <P>TODO该类...</P>
* @author renweiping
* @date 2018年9月18日 下午5:41:34
* @version 1.0
*/

package com.micro.boot.biz.user.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import com.micro.boot.base.dao.BaseMapper;
import com.micro.boot.base.service.BaseServiceImpl;
import com.micro.boot.biz.user.dao.UserMapper;
import com.micro.boot.biz.user.domain.User;

/**
 * @Description: 用户接口实现类
 * @param
 * @throws @author
 *             renweiping
 * @e_mail renweiping_1113@google.com
 * @date 2018年9月18日
 */

@Service
public class UserServiceImpl extends BaseServiceImpl<User,Integer> implements UserService {
	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	@Autowired
	private UserMapper userMapper;

	@Autowired
	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.micro.boot.base.service.BaseServiceImpl#getBaseMapper()
	 */
	@Override
	protected BaseMapper<User, Integer> getBaseMapper() {
		// TODO Auto-generated method stub
		return userMapper;
	}

	/* (non-Javadoc)
	 * @see com.micro.boot.biz.user.service.UserService#getUserJdbc(java.lang.Integer)
	 */
	@Override
	public User getUserByJdbc(Integer id) {

		 List<User> list = jdbcTemplate.query("select * from USER where id = ?", new Object[]{id}, new BeanPropertyRowMapper(User.class));
	        if(list!=null && list.size()>0){
	        	User account = list.get(0);
	            return account;
	        }else{
	            return null;
	        }
	
	}

}
